﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Setting.master" AutoEventWireup="true" CodeFile="users.aspx.cs" Inherits="Setting_users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="SettingHeader" Runat="Server">
	<style type="text/css">
         #searchBar{ padding:10px 0px 5px 0px;}
         #btnBar{ padding:10px 0px; }
     </style>
     <script type="text/javascript">
     	var curUserName = "";

     	$(function () {
     		$('.commonTable tr').hover(function () {
     			$(this).css('background-color', '#ffffae');
     		},
            function () {
            	$(this).css('background-color', '#FFFFFF');
            });
     	});

       function addUser() {
     		window.open('add_user.aspx', '', 'width=350px,height=250px,scrollbars=1,resizable=no,left=' + (screen.availWidth - 350) / 2 + ',top=' + (screen.availHeight - 250) / 2);
     	}
     	function toggleUser(id,i) {
     		if (confirm('确定更改用户状态?'))
     			window.location = "users.aspx?userID=" + id + "&disabled=" + i;
     	}
     	function viewEmpl(id) {
     		window.open('add_employee.aspx?id='+ id, '', 'width=600px,height=500px,scrollbars=1,resizable=no,left=' + (screen.availWidth - 600) / 2 + ',top=' + (screen.availHeight - 500) / 2);
     	}
     	function chooseEmpl(usrname) {
     		curUserName = usrname;
     		//alert(curUserName);
     		//$("#hidSelUserName").val(usrname);
     		window.open('dlg_user.aspx?selmode=1', '', 'width=400px,height=400px,scrollbars=1,resizable=no,left=' + (screen.availWidth - 400) / 2 + ',top=' + (screen.availHeight - 400) / 2);
     	}
     	function recvSelectUser(selNodes) {
     		if (selNodes != null && typeof (selNodes) != 'undefined') {

     			var selEmplId = '';
     			$.map(selNodes, function (node) {
     				selEmplId = node.data.key;
     			});

     			alert(curUserName );

     			$.post("do_SaveUserEmpl.aspx", { userName: curUserName, emplID: selEmplId },
			        function (data) {
			        	if (data == "ok")
			        		window.location.reload();
			        	else
			        		alert("保存失败!");
			        });
     		}
     	}
     	function GoPage(n) {
     		window.location = "users.aspx?p=" + n;
     	}         
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SettingContent" Runat="Server">
<div class="navTitle"><a href="#">系统设置</a> > 用户</div>
<div>
    <table class="commonTable" cellspacing="0" cellpadding="5" >
	    <tr>
		    <th>名称</th>
			<th>人员</th>
		    <th>
		    </th>
	    </tr>
        <% WriteTableData();%>
	</table>
	<div class="gridPager">
		<%WriteTablePager(); %>
	</div>
    <div id="btnBar"><input type="button" value="添加用户" onclick="addUser()" /><input type="hidden" id="hidSelUserName" value="" /></div>
</div>
</asp:Content>

